<template>
  <div class="page_search search_index">
	<div class="warp">
	  <div class="container">
		<div class="row">
		  <div class="col-12">
			<div class="card_result_search">
			  <div class="title">搜索结果</div>

				<!-- 文章搜索结果 -->
			  <list_result_search
				:list="result_article"
				title="新闻资讯"
				source_table="article"
			  ></list_result_search>


						  <list_result_search
				v-if="$check_action('/teacher_users/list', 'get')"
				:list="result_teacher_users_teachers_name"
				title="教师用户教师姓名"
				source_table="teacher_users"
			  ></list_result_search>
															  <list_result_search
				v-if="$check_action('/student_users/list', 'get')"
				:list="result_student_users_student_name"
				title="学生用户学生姓名"
				source_table="student_users"
			  ></list_result_search>
															  <list_result_search
				v-if="$check_action('/fraud_classification/list', 'get')"
				:list="result_fraud_classification_fraud_classification"
				title="诈骗分类诈骗分类"
				source_table="fraud_classification"
			  ></list_result_search>
									  <list_result_search
				v-if="$check_action('/fraud_knowledge/list', 'get')"
				:list="result_fraud_knowledge_scam_name"
				title="诈骗知识诈骗名称"
				source_table="fraud_knowledge"
			  ></list_result_search>
								  <list_result_search
				v-if="$check_action('/fraud_knowledge/list', 'get')"
				:list="result_fraud_knowledge_fraud_classification"
				title="诈骗知识诈骗分类"
				source_table="fraud_knowledge"
			  ></list_result_search>
																					  <list_result_search
				v-if="$check_action('/fraud_case/list', 'get')"
				:list="result_fraud_case_case_name"
				title="诈骗案例案例名称"
				source_table="fraud_case"
			  ></list_result_search>
								  <list_result_search
				v-if="$check_action('/fraud_case/list', 'get')"
				:list="result_fraud_case_case_type"
				title="诈骗案例案例类型"
				source_table="fraud_case"
			  ></list_result_search>
																								  <list_result_search
				v-if="$check_action('/publicity_and_education/list', 'get')"
				:list="result_publicity_and_education_promotion_name"
				title="宣传教育宣传名称"
				source_table="publicity_and_education"
			  ></list_result_search>
								  <list_result_search
				v-if="$check_action('/publicity_and_education/list', 'get')"
				:list="result_publicity_and_education_promotion_type"
				title="宣传教育宣传类型"
				source_table="publicity_and_education"
			  ></list_result_search>
																								  <list_result_search
				v-if="$check_action('/communication_classification/list', 'get')"
				:list="result_communication_classification_communication_classification"
				title="交流分类交流分类"
				source_table="communication_classification"
			  ></list_result_search>
									  <list_result_search
				v-if="$check_action('/community_communication/list', 'get')"
				:list="result_community_communication_exchange_title"
				title="社区交流交流标题"
				source_table="community_communication"
			  ></list_result_search>
								  <list_result_search
				v-if="$check_action('/community_communication/list', 'get')"
				:list="result_community_communication_communication_classification"
				title="社区交流交流分类"
				source_table="community_communication"
			  ></list_result_search>
																								  <list_result_search
				v-if="$check_action('/report_information/list', 'get')"
				:list="result_report_information_exchange_title"
				title="举报信息交流标题"
				source_table="report_information"
			  ></list_result_search>
								  <list_result_search
				v-if="$check_action('/report_information/list', 'get')"
				:list="result_report_information_communication_classification"
				title="举报信息交流分类"
				source_table="report_information"
			  ></list_result_search>
																					</div>
		  </div>
		</div>
	  </div>
	</div>
  </div>
</template>

<script>
import mixin from "../../mixins/page.js";
import list_result_search from "../../components/diy/list_result_search.vue";

export default {
  mixins: [mixin],
  data() {
	return {
	  "query": {
		word: "",
	  },
	  "result_article": [],
						"result_teacher_users_teachers_name":[],
															"result_student_users_student_name":[],
															"result_fraud_classification_fraud_classification":[],
									"result_fraud_knowledge_scam_name":[],
								"result_fraud_knowledge_fraud_classification":[],
																					"result_fraud_case_case_name":[],
								"result_fraud_case_case_type":[],
																								"result_publicity_and_education_promotion_name":[],
								"result_publicity_and_education_promotion_type":[],
																								"result_communication_classification_communication_classification":[],
									"result_community_communication_exchange_title":[],
								"result_community_communication_communication_classification":[],
																								"result_report_information_exchange_title":[],
								"result_report_information_communication_classification":[],
																			};
  },
  methods: {
	/**
	 * 获取文章
	 */
	get_article() {
	  this.$get("~/api/article/get_list?like=0", { page: 1, size: 10, title: this.query.word }, (json) => {
		if (json.result) {
		  this.result_article = json.result.list;
		}
	  });
	},

				/**
	 * 获取teachers_name
	 */
	get_teacher_users_teachers_name(){
		let url = "~/api/teacher_users/get_list?like=0";
				this.$get(url, { page: 1, size: 10, "teachers_name": this.query.word }, (json) => {
		  if (json.result) {
			var result_teacher_users_teachers_name = json.result.list;
			result_teacher_users_teachers_name.map(o => o.title = o['teachers_name'])
	  			this.result_teacher_users_teachers_name = result_teacher_users_teachers_name
		 	}
		});
	},
													/**
	 * 获取student_name
	 */
	get_student_users_student_name(){
		let url = "~/api/student_users/get_list?like=0";
				this.$get(url, { page: 1, size: 10, "student_name": this.query.word }, (json) => {
		  if (json.result) {
			var result_student_users_student_name = json.result.list;
			result_student_users_student_name.map(o => o.title = o['student_name'])
	  			this.result_student_users_student_name = result_student_users_student_name
		 	}
		});
	},
													/**
	 * 获取fraud_classification
	 */
	get_fraud_classification_fraud_classification(){
		let url = "~/api/fraud_classification/get_list?like=0";
				this.$get(url, { page: 1, size: 10, "fraud_classification": this.query.word }, (json) => {
		  if (json.result) {
			var result_fraud_classification_fraud_classification = json.result.list;
			result_fraud_classification_fraud_classification.map(o => o.title = o['fraud_classification'])
	  			this.result_fraud_classification_fraud_classification = result_fraud_classification_fraud_classification
		 	}
		});
	},
							/**
	 * 获取scam_name
	 */
	get_fraud_knowledge_scam_name(){
		let url = "~/api/fraud_knowledge/get_list?like=0";
				this.$get(url, { page: 1, size: 10, "scam_name": this.query.word }, (json) => {
		  if (json.result) {
			var result_fraud_knowledge_scam_name = json.result.list;
			result_fraud_knowledge_scam_name.map(o => o.title = o['scam_name'])
	  			this.result_fraud_knowledge_scam_name = result_fraud_knowledge_scam_name
		 	}
		});
	},
						/**
	 * 获取fraud_classification
	 */
	get_fraud_knowledge_fraud_classification(){
		let url = "~/api/fraud_knowledge/get_list?like=0";
				this.$get(url, { page: 1, size: 10, "fraud_classification": this.query.word }, (json) => {
		  if (json.result) {
			var result_fraud_knowledge_fraud_classification = json.result.list;
			result_fraud_knowledge_fraud_classification.map(o => o.title = o['fraud_classification'])
	  			this.result_fraud_knowledge_fraud_classification = result_fraud_knowledge_fraud_classification
		 	}
		});
	},
																			/**
	 * 获取case_name
	 */
	get_fraud_case_case_name(){
		let url = "~/api/fraud_case/get_list?like=0";
				this.$get(url, { page: 1, size: 10, "case_name": this.query.word }, (json) => {
		  if (json.result) {
			var result_fraud_case_case_name = json.result.list;
			result_fraud_case_case_name.map(o => o.title = o['case_name'])
	  			this.result_fraud_case_case_name = result_fraud_case_case_name
		 	}
		});
	},
						/**
	 * 获取case_type
	 */
	get_fraud_case_case_type(){
		let url = "~/api/fraud_case/get_list?like=0";
				this.$get(url, { page: 1, size: 10, "case_type": this.query.word }, (json) => {
		  if (json.result) {
			var result_fraud_case_case_type = json.result.list;
			result_fraud_case_case_type.map(o => o.title = o['case_type'])
	  			this.result_fraud_case_case_type = result_fraud_case_case_type
		 	}
		});
	},
																						/**
	 * 获取promotion_name
	 */
	get_publicity_and_education_promotion_name(){
		let url = "~/api/publicity_and_education/get_list?like=0";
				url = url+"&examine_state=已通过";
				this.$get(url, { page: 1, size: 10, "promotion_name": this.query.word }, (json) => {
		  if (json.result) {
			var result_publicity_and_education_promotion_name = json.result.list;
			result_publicity_and_education_promotion_name.map(o => o.title = o['promotion_name'])
	  			this.result_publicity_and_education_promotion_name = result_publicity_and_education_promotion_name
		 	}
		});
	},
						/**
	 * 获取promotion_type
	 */
	get_publicity_and_education_promotion_type(){
		let url = "~/api/publicity_and_education/get_list?like=0";
				url = url+"&examine_state=已通过";
				this.$get(url, { page: 1, size: 10, "promotion_type": this.query.word }, (json) => {
		  if (json.result) {
			var result_publicity_and_education_promotion_type = json.result.list;
			result_publicity_and_education_promotion_type.map(o => o.title = o['promotion_type'])
	  			this.result_publicity_and_education_promotion_type = result_publicity_and_education_promotion_type
		 	}
		});
	},
																						/**
	 * 获取communication_classification
	 */
	get_communication_classification_communication_classification(){
		let url = "~/api/communication_classification/get_list?like=0";
				this.$get(url, { page: 1, size: 10, "communication_classification": this.query.word }, (json) => {
		  if (json.result) {
			var result_communication_classification_communication_classification = json.result.list;
			result_communication_classification_communication_classification.map(o => o.title = o['communication_classification'])
	  			this.result_communication_classification_communication_classification = result_communication_classification_communication_classification
		 	}
		});
	},
							/**
	 * 获取exchange_title
	 */
	get_community_communication_exchange_title(){
		let url = "~/api/community_communication/get_list?like=0";
				url = url+"&examine_state=已通过";
				this.$get(url, { page: 1, size: 10, "exchange_title": this.query.word }, (json) => {
		  if (json.result) {
			var result_community_communication_exchange_title = json.result.list;
			result_community_communication_exchange_title.map(o => o.title = o['exchange_title'])
	  			this.result_community_communication_exchange_title = result_community_communication_exchange_title
		 	}
		});
	},
						/**
	 * 获取communication_classification
	 */
	get_community_communication_communication_classification(){
		let url = "~/api/community_communication/get_list?like=0";
				url = url+"&examine_state=已通过";
				this.$get(url, { page: 1, size: 10, "communication_classification": this.query.word }, (json) => {
		  if (json.result) {
			var result_community_communication_communication_classification = json.result.list;
			result_community_communication_communication_classification.map(o => o.title = o['communication_classification'])
	  			this.result_community_communication_communication_classification = result_community_communication_communication_classification
		 	}
		});
	},
																						/**
	 * 获取exchange_title
	 */
	get_report_information_exchange_title(){
		let url = "~/api/report_information/get_list?like=0";
				url = url+"&examine_state=已通过";
				this.$get(url, { page: 1, size: 10, "exchange_title": this.query.word }, (json) => {
		  if (json.result) {
			var result_report_information_exchange_title = json.result.list;
			result_report_information_exchange_title.map(o => o.title = o['exchange_title'])
	  			this.result_report_information_exchange_title = result_report_information_exchange_title
		 	}
		});
	},
						/**
	 * 获取communication_classification
	 */
	get_report_information_communication_classification(){
		let url = "~/api/report_information/get_list?like=0";
				url = url+"&examine_state=已通过";
				this.$get(url, { page: 1, size: 10, "communication_classification": this.query.word }, (json) => {
		  if (json.result) {
			var result_report_information_communication_classification = json.result.list;
			result_report_information_communication_classification.map(o => o.title = o['communication_classification'])
	  			this.result_report_information_communication_classification = result_report_information_communication_classification
		 	}
		});
	},
																		
  },
  components: { list_result_search },
	created(){
    this.query.word = this.$route.query.word || "";
  },
  mounted() {
	this.get_article();
					this.get_teacher_users_teachers_name();
														this.get_student_users_student_name();
														this.get_fraud_classification_fraud_classification();
								this.get_fraud_knowledge_scam_name();
							this.get_fraud_knowledge_fraud_classification();
																				this.get_fraud_case_case_name();
							this.get_fraud_case_case_type();
																							this.get_publicity_and_education_promotion_name();
							this.get_publicity_and_education_promotion_type();
																							this.get_communication_classification_communication_classification();
								this.get_community_communication_exchange_title();
							this.get_community_communication_communication_classification();
																							this.get_report_information_exchange_title();
							this.get_report_information_communication_classification();
																		  },
  watch: {
	$route() {
	  $.push(this.query, this.$route.query);
	  this.get_article();
				  this.get_teacher_users_teachers_name();
													  this.get_student_users_student_name();
													  this.get_fraud_classification_fraud_classification();
							  this.get_fraud_knowledge_scam_name();
						  this.get_fraud_knowledge_fraud_classification();
																			  this.get_fraud_case_case_name();
						  this.get_fraud_case_case_type();
																						  this.get_publicity_and_education_promotion_name();
						  this.get_publicity_and_education_promotion_type();
																						  this.get_communication_classification_communication_classification();
							  this.get_community_communication_exchange_title();
						  this.get_community_communication_communication_classification();
																						  this.get_report_information_exchange_title();
						  this.get_report_information_communication_classification();
																			},
  },
};
</script>

<style scoped>
.card_search {
  text-align: center;
}
.card_result_search>.title {
  text-align: center;
  padding: 10px 0;
}
</style>
